function addmsg(index,company,position,interviewTime,address,currTime) {
	
	//Preparing the new msg inbox
	var inbox = '<div id="space"></div>'
				+'<div id="div_inbox'+index+'"'+' class="inboxmsg">'
					+'<table id="inbox'+index+'"'+' cellspacing="0" class="tablescroll">'
						+'<tr class="header">'
						+'<td class="theader2">Company Name</td>'
						+'<td class="theader2">Position</td>'
						+'<td class="theader2">Interview At</td>'
						+'<td class="theader2">Address</td>'
						+'<td class="theader2">Received At</td>'
						+'</tr>'
						+'<tr><td>'+company+'</td> <td>'+position+'</td><td>'+interviewTime+'</td>'+'<td>'+address+'</td>'+'<td>'+currTime+'</td>'+'</tr>'
					+'</table>'
					+'<ol>'
						+'<li id="buttons">'
							+'<button type="button" class="button" id="accept"> Accept <img src="../images/VIcon.gif" alt="icon"/> </button>' 
							+'<button type="button" class="button"  id="decline"> Decline <img src="../images/decline.png" alt="icon"/> </button>'	
						+'</li>'
					+'</ol>'						
				+'</div>';
	
		$('#empty').after(inbox);
		
		
	
}

function setBlockUI(content,top,left) {
	
	$.blockUI( { 
		
		message: $(content), 
		// disable horz centering 
        centerX: false, 
        // disable vertical centering 
        centerY: false, 
                   
        // apply css props as desired              
        css: { top: top, left: left }

	} );
	
}

$(document).ready(function() {
	
	var browser;
	
	//forcing default cursor
	$.blockUI.defaults.css.cursor = 'default';
	
	//Setting styles per browser
	
	// IE
	if($.browser.msie) {
		 browser="IE";
		$('head').append('<link rel="stylesheet" type="text/css" href="../CSS/IE_sticky.full.css" media="all">" />');
		$('head').append('<link rel="stylesheet" type="text/css" href="../CSS/IE_inbox.css" media="all">');	
	}
	// Chrome, maybe FireFox too (need to test)
	else {
		 browser="CH";
		$('head').append('<link rel="stylesheet" type="text/css" href="../CSS/CH_sticky.full.css" media="all">" />');
		$('head').append('<link rel="stylesheet" type="text/css" href="../CSS/CH_inbox.css" media="all">');		
	}
	
	$("#create_inbox").click(function() {

		var index = 1;
		var company = 'Yamaha';
		var position = 'QA Student';
		var interviewTime = '14/5/2012 14:24';
		var address = 'Independence Street 34, Tel Aviv';
		var date = new Date();
		var month = date.getMonth()+1;
		var currTime= date.getDate()+'/'+month+'/'+date.getFullYear()+' '+date.getHours()+':'+date.getMinutes();
		//var currTime = "06/05/2012 00:08";
			
		addmsg(index,company,position,interviewTime,address,currTime);
		
		$.sticky('<b> You have a new message </b>');
			
	});	
	

	$('#show_inbox').click(function () {

		
		if(browser=="IE")
		{
			var top="20px";
			var left="130px";
			setBlockUI("#content",top,left);
		}		
		else
		{
			var top="20px";
			var left="400px";
			setBlockUI("#content",top,left);
		}
		
	});

	$('#unblock').click(function () {
		
		$.unblockUI(); 
		
	});
});